package com.vecspace.database.model;

import java.util.List;

import com.vecspace.data.model.IPagination;


/**SQL查询结果,包括原始记录以及聚合结果
 * T: 数据列表中的对象，可以是POJO，也可以是Map类
 * R：聚合数据对象，可以是POJO，也可以是Map类
 * @version 1.0
 * @author wanghua
 * @reviewer  
 * @createTime 2021年9月29日 下午1:29:00
 */
public class QueryResultAggregation<T, R> extends QueryResult<T>{
	
	public QueryResultAggregation() {
		
	}
	
	public QueryResultAggregation(List<T> entities, List<R> aggregateEntities) {
		super(entities);
		this.setAggregateEntities(aggregateEntities);
	}
	
	public QueryResultAggregation(List<T> entities, IPagination pagination, List<R> aggregateEntities) {
		super(entities, pagination);
		this.setAggregateEntities(aggregateEntities);
	}
		
	/**聚合（统计）查询结果 */
	private List<R> aggregateEntities;
	
	/**是否包含聚合对象
	 * 
	 * @return 
	 * @author wanghua
	 * @reviewer  
	 * @createTime 2021年9月29日 下午1:39:51
	 */
	public boolean isContainsAggregate() {
		return aggregateEntities != null && aggregateEntities.size() > 0;
	}
	
	/**聚合（统计）查询结果 */
	public List<R> getAggregateEntities() {
		return aggregateEntities;
	}
	/**聚合（统计）查询结果 */
	public void setAggregateEntities(List<R> aggregateEntities) {
		this.aggregateEntities = aggregateEntities;
	}
}

